##################################################################
# File : /lua/simcallbacks.lua
# Description : Simcallbacks module
# Author : GPG
##################################################################

#
#
# This module contains the Sim-side lua functions that can be invoked
# from the user side.  These need to validate all arguments against
# cheats and exploits.
#

# We store the callbacks in a sub-table (instead of directly in the
# module) so that we don't include any

local Callbacks = {}

function DoCallback(name, data, units)
    local fn = Callbacks[name];
    if fn then
        fn(data, units)
    else
        error('No callback named ' .. repr(name))
    end
end

Callbacks.CreateViewerEntityFromCharacter = import('/lua/sim/SimResourceViewer.lua').CreateViewerEntityFromCharacter
Callbacks.RefreshSimPlaylist = import('/lua/sim/SimResourceViewer.lua').RefreshSimPlaylist


local SimPing = import('/lua/SimPing.lua')
Callbacks.SpawnPing = SimPing.SpawnPing
Callbacks.UpdateMarker = SimPing.UpdateMarker

Callbacks.OnCameraFinish = import('/lua/sim/SimCamera.lua').OnCameraFinish
